package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Rectangle;
	import flash.system.Security;
	
	import starling.core.Starling;
	import game.TDGame;
	
	public class TowerDefence extends Sprite
	{
		private var _starling:Starling;
		
		public function TowerDefence()
		{
			// 支持 autoOrient
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			//Security.allowDomain("*");
			//Security.allowInsecureDomain("*");
			
			if(stage)		init();
			else this.addEventListener(Event.ADDED_TO_STAGE,init);
		}
		
		private function init(e:Event = null):void
		{
			var viewPort:Rectangle = new Rectangle();
			var fw:Number = Math.max(stage.fullScreenHeight , stage.fullScreenWidth);
			var fh:Number = Math.min(stage.fullScreenHeight , stage.fullScreenWidth);
			
			_starling = new Starling(TDGame , this.stage , viewPort);
		}
	}
}